package com.atguigu.springcloud.service;

import com.atguigu.springcloud.service.impl.PaymentFallbackServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author daiyongfei
 * cloud-eureka-payment-service
 * <p>
 * fallback = PaymentFallbackServiceImpl.class 指定降级处理类
 */
@Component
@FeignClient(value = "cloud-provider-hystrix-payment", fallback = PaymentFallbackServiceImpl.class)
public interface PaymentHystrixService {

    @GetMapping("/payment/hystrix/ok/{id}")
    public String paymentInfoOK(@PathVariable("id") Integer id);

    @GetMapping("/payment/hystrix/timeout/{id}")
    public String paymentInfoTimeOut(@PathVariable("id") Integer id);


    /**
     * 降级
     *
     * @param id
     * @return
     */
    @GetMapping("/payment/hystrix/timeout1/{id}")
    public String paymentInfoTimeOut1(@PathVariable("id") Integer id);


}
